package com.esri.android.map;

import android.util.Log;
import com.esri.android.map.popup.PopupLayer;
import com.esri.core.map.Feature;

/* loaded from: classes.dex */
public abstract class TiledLayer extends Layer implements PopupLayer {
    static float a = 192.0f;
    protected float bufferExpansionFactor;

    native void clearTiles(long j);

    @Override // com.esri.android.map.popup.PopupLayer
    public boolean isPopupAllowGeometryUpdate(Feature feature) {
        return false;
    }

    @Override // com.esri.android.map.popup.PopupLayer
    public boolean isPopupDeletable(Feature feature) {
        return false;
    }

    @Override // com.esri.android.map.popup.PopupLayer
    public boolean isPopupEditable(Feature feature) {
        return false;
    }

    native int nativeComputeLOD(long j, long j2);

    native float nativeGetBrightness(long j);

    native float nativeGetContrast(long j);

    native float nativeGetGamma(long j);

    native boolean nativeIsBufferEnabled(long j);

    native void nativeSetBrightness(long j, float f);

    native void nativeSetBufferEnabled(long j, boolean z);

    native void nativeSetBufferExpansionFactor(long j, float f);

    native void nativeSetContrast(long j, float f);

    native void nativeSetGamma(long j, float f);

    public TiledLayer(String str, boolean z) {
        super(z);
        this.bufferExpansionFactor = 1.0f;
        setUrl(str);
    }

    public TiledLayer(boolean z) {
        super(z);
        this.bufferExpansionFactor = 1.0f;
    }

    public float getBrightness() {
        if (this.nativeHandle != 0) {
            return nativeGetBrightness(this.nativeHandle);
        }
        return Float.NaN;
    }

    public void setBrightness(float f) {
        if (this.nativeHandle != 0) {
            nativeSetBrightness(this.nativeHandle, f);
        }
    }

    public float getContrast() {
        if (this.nativeHandle != 0) {
            return nativeGetContrast(this.nativeHandle);
        }
        return Float.NaN;
    }

    public void setContrast(float f) {
        if (this.nativeHandle != 0) {
            nativeSetContrast(this.nativeHandle, f);
        }
    }

    public float getGamma() {
        if (this.nativeHandle != 0) {
            return nativeGetGamma(this.nativeHandle);
        }
        return Float.NaN;
    }

    public void setGamma(float f) {
        if (this.nativeHandle != 0) {
            nativeSetGamma(this.nativeHandle, f);
        }
    }

    public void clearTiles() {
        if (this.nativeHandle != 0) {
            clearTiles(this.nativeHandle);
        }
    }

    public int getCurrentLevel() {
        if (this.nativeHandle == 0 || this.m == null) {
            return -1;
        }
        return nativeComputeLOD(this.nativeHandle, this.m.l);
    }

    @Override // com.esri.android.map.Layer
    public void setRenderNativeResolution(boolean z) {
        super.setRenderNativeResolution(z);
        if (getDpi() != 0.0f) {
            float dpi = getDpi();
            if (z) {
                setRenderPixelsPerInch(dpi);
                return;
            }
            float f = a;
            if (dpi >= f) {
                setRenderPixelsPerInch(f);
            } else {
                setRenderPixelsPerInch(dpi);
            }
        }
    }

    public float getBufferExpansionFactor() {
        return this.bufferExpansionFactor;
    }

    public void setBufferExpansionFactor(float f) {
        if (f >= 1.0f && f <= 2.0f) {
            this.bufferExpansionFactor = f;
        } else {
            this.bufferExpansionFactor = f > 2.0f ? 2.0f : 1.0f;
            Log.w(com.esri.core.internal.a.a, "buffer factor is not valid, it is reset as " + this.bufferExpansionFactor);
        }
        nativeSetBufferExpansionFactor(this.nativeHandle, this.bufferExpansionFactor);
    }

    public boolean isBufferEnabled() {
        return nativeIsBufferEnabled(this.nativeHandle);
    }

    public void setBufferEnabled(boolean z) {
        nativeSetBufferEnabled(this.nativeHandle, z);
    }
}
